home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / HeapScheduler.cc,v < prev    next >
Text File  |  1988-12-20  |  2KB  |  116 lines

  1. head     3.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 3.1
  10. date     88.12.20.13.48.51;  author grunwald;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     88.10.30.13.03.09;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.09.18.16.42.24;  author grunwald;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29.  
  30. 3.1
  31. log
  32. @Steay version
  33. @
  34. text
  35. @// This may look like C code, but it is really -*- C++ -*-
  36. // 
  37. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  38. //
  39. // written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  40. //
  41. #include "Thread.h"
  42. #include "HeapScheduler.h"
  43. #include "stream.h"
  44. #include "assert.h"
  45. void
  46. HeapScheduler::add(Thread *t)
  47. {
  48.     heap.add( ThreadHeapItem(t) );
  49. }
  50.  
  51. void
  52. HeapScheduler::add(double xkey, Thread *t)
  53. {
  54.     t -> priority(ThreadPriority(xkey));
  55.     heap.add( ThreadHeapItem(t) );
  56. }
  57.  
  58. void
  59. HeapScheduler::add(int xkey, Thread *t)
  60. {
  61.     t -> priority(ThreadPriority(xkey));
  62.     heap.add( ThreadHeapItem(t) );
  63. }
  64.  
  65. Thread *
  66. HeapScheduler::remove()
  67. {
  68.     ThreadHeapItem item;
  69.     int removed = heap.remove(item);
  70.     assert(removed);
  71.     return(item.thread());
  72. }
  73.  
  74. Thread *
  75. HeapScheduler::remove(Thread *)
  76. {
  77.     assert2(FALSE, "[HeapScheduler]: remove of specific item not implemented");
  78.     return(0);
  79. }
  80.  
  81. bool HeapScheduler::isEmpty()
  82. {
  83.     return(heap.isEmpty());
  84. }
  85.  
  86. unsigned int HeapScheduler::size()
  87. {
  88.     return(heap.size());
  89. }
  90.  
  91. void HeapScheduler::classPrintOn(ostream& s)
  92. {
  93.     s << "[HeapScheduler] " << heap;
  94. }
  95. @
  96.  
  97.  
  98. 1.2
  99. log
  100. @*** empty log message ***
  101. @
  102. text
  103. @@
  104.  
  105.  
  106. 1.1
  107. log
  108. @Initial revision
  109. @
  110. text
  111. @d1 6
  112. d35 2
  113. a36 1
  114.     heap.remove(item);
  115. @
  116.